-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QCAlgorithm
's OptionChain()
api refactor
#8334
Merged
jhonabreul
merged 38 commits into
QuantConnect:master
from
jhonabreul:bug-8331-option-chain-dataframe
Oct 4, 2024
Merged
QCAlgorithm
's OptionChain()
api refactor
#8334
jhonabreul
merged 38 commits into
QuantConnect:master
from
jhonabreul:bug-8331-option-chain-dataframe
Oct 4, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jhonabreul
force-pushed
the
bug-8331-option-chain-dataframe
branch
from
September 25, 2024 21:50
dfffb99
to
8bd8117
Compare
Take into consideration data for multiple symbols in the same list
Also add pass-through properties for greek values in OptionUniverse
- Use OptionChains as output - Add DataFrame to OptionChain and OptionChains - Rename Greeks classes - Add ISymbolProvider for classes that have a symbol (IBaseData, OptionContract)
Also refactor OptionContract to handle: (1) Actual market data and option price model data, and (2) OptionUniverse data
Add NullGreeks class: keep ModeledGreeks as internal as possible
jhonabreul
force-pushed
the
bug-8331-option-chain-dataframe
branch
from
September 26, 2024 23:17
fd88ae2
to
5d0e18d
Compare
jhonabreul
changed the title
Dataframe from list of data with multiple symbols
Sep 27, 2024
QCAlgorithm
's OptionChain()
and OptionChains()
api refactor
jhonabreul
changed the title
Sep 27, 2024
QCAlgorithm
's OptionChain()
and OptionChains()
api refactorQCAlgorithm
's OptionChain()
api refactor
Address peer review
This allows propery hash and equality between Symbols, C# strings and Python strings
Martin-Molinero
approved these changes
Oct 4, 2024
11 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This is a refactoring of the
QCAlgorithm.OptionChain()
API for fetching an option chain:DataHistory<OptionUniverse>
toOptionChain
:DataFrame
property toOptionChain
to convert the option chain into a PandasDataFrame
.QCAlgorithm.OptionChains()
method to fetch option chains for multiple symbols:DataFrame
property toOptionChains
to convert the option chain into a PandasDataFrame
. This dataframe will have a multi-index which first level is the canonical option. Indexing by the canonical symbol will result in a sub data frame equivalent to the one generated for a singleOptionChain
.Additional changes:
PandasConverter.GetDataFrame<T>(IEnumerable<T> data)
doesn't assume the data is for a single symbol. For instance, if an option chain (IEnumerable<ContractData>
) is to be converted to a data frame, each item will correspond to a single symbol, that is, each contract.Symbol
instances, instead of the symbol ID/Value string. This way, users can access it and use theSymbol
directly for other operations, like manually adding option contracts.Data frame before:
Sample:
Data frame after (single option chain):
Sample:
Data frame after (multiple option chains):
Sample:
Related Issue
Closes #8331
Motivation and Context
Requires Documentation Change
How Has This Been Tested?
Types of changes
Checklist:
bug-<issue#>-<description>
orfeature-<issue#>-<description>